package com.googlecode.messwertepi.module;

import com.google.inject.AbstractModule;
import com.google.inject.Singleton;
import com.googlecode.messwertepi.configuration.Configuration;
import com.googlecode.messwertepi.model.DataModel;
import com.googlecode.messwertepi.services.DefaultInputService;
import com.googlecode.messwertepi.services.InputService;
import com.pi4j.io.gpio.GpioController;
import gnu.io.SerialPort;

/**
 * Created by eike on 25.06.14.
 */
public class MainModule extends AbstractModule
{
    @Override
    protected void configure()
    {
        // bootstrap the application
        bind(Configuration.class).toProvider(ConfigurationProvider.class).asEagerSingleton();

        // dummy data generators
        bind(DataModel.class).toProvider(DummyDataModelProvider.class).in(Singleton.class);

        // bind the services
        bind(InputService.class).to(DefaultInputService.class).in(Singleton.class);
        bind(SerialPort.class).toProvider(SerialPortProvider.class);
        bind(GpioController.class).toProvider(GpioControllerProvider.class);
    }
}
